layui.define(['table', 'form', 'laydate', 'selectM'], function(exports){
  var $ = layui.$,form = layui.form, selectM = layui.selectM, laydate = layui.laydate;
  
  var cashWithdrawalWeeks = $('#cashWithdrawalWeeksValue').val();
  var memberCashWithdrawalWeeks = $('#memberCashWithdrawalWeeksValue').val();
  
  laydate.render({
      elem: '#cashWithdrawalTimes'
      , type: 'time'
      , range: true
      , trigger: 'click'
  });

  laydate.render({
      elem: '#memberCashWithdrawalTimes'
      , type: 'time'
      , range: true
      , trigger: 'click'
  });

  selectM({
      elem: '#cashWithdrawalWeeks'
      , data: layui.setter.webRoot + '/config/cash_withdrawal/weeks.data'
      , field: {idName: 'id', titleName: 'text', statusName: 'status'}
      , selected: cashWithdrawalWeeks
      , max: 7
  });

  selectM({
      elem: '#memberCashWithdrawalWeeks'
      , data: layui.setter.webRoot + '/config/cash_withdrawal/weeks.data'
      , field: {idName: 'id', titleName: 'text', statusName: 'status'}
      , selected: memberCashWithdrawalWeeks
      , max: 7
  });
 
  $('#userId').select2({
      placeholder: "请选择账号归属代理",
	  width: '250px',
      theme: 'bootstrap',
      allowClear : true,
      ajax: {
          url: layui.setter.webRoot + '/agent/select.data',
          method: 'post',
          delay: 250,
          processResults: function (result) {
              if (result.code == 200) {
                  return {
                      pagination: {more: result.body.more},
                      results: result.body.data || []
                  };
              } else {
                  return {results: []};
              }
          }
      }
  });
  exports('account_group_info', {})
});